#include "trap.h"
   .set noat
   .globl main
   .text

main:
    addi $v0, $v0, 0x0010
    addi $v1, $v1, 0x0010
    beq $v0, $v1, PART1
    addi $k0, $k0, 0x0001

PART0:
    addi $a0, $a0, 0x0001
    jal PART9
    addi $k0, $k0, 0x0100
    addi $t8, $t8, 0x0001
    addi $s7, $s7, 0x0004
    jr $s7
    addi $k0, $k0, 0x0200

PART1:
    addi $t0, $t0, 0x0001        #$t0 = 0x00000001
    addi $v1, 0x0010
    bne $v0, $v1, PART2
    addi $k0, $k0, 0x0002

PART2:
    addi $t1, $t1, 0x0001
    sub $s0, $t1        #$s0 = 0xffffffff
    bgez $s0, ERR
    bgez $s1, PART3        #$s1 = 0x00000000
    addi $k0, $k0, 0x0004

PART3:
    addi $t2, $t2, 0x0001
    bgtz $s0, ERR
    bgtz $s1, ERR
    bgtz $t0, PART4
    addi $k0, $k0, 0x0008

PART4:
    addi $t3, $t3, 0x0001
    blez $t0, ERR
    blez $s0, PART5
    addi $k0, $k0, 0x0010

PART5:
    addi $t4, $t4, 0x0001
    bltz $s1, ERR
    bltz $t0, ERR
    bltz $s0, PART6
    addi $k0, $k0, 0x0020

PART6:
    addi $t5, $t5, 0x0001
    bgezal $s0, ERR
    bgezal $t0, PART7
    addi $k0, $k0, 0x0040

PART7:
    addi $t6, $t6, 0x0001
    bltzal $t0, ERR
    bltzal $s1, ERR
    bltzal $s0, PART8
    addi $k0, $k0, 0x0080

PART8:
    addi $t7, $t7, 0x0001
    j PART0
    addi $k0, $k0, 0x0000

PART9:
    addi $ra, $ra, 0x0004
    jalr $s7, $ra
    addi $k0, $k0, 0x0400
    addi $t9, $t9, 0x0001
    j ENDP
    addi $k0, $k0, 0x0800


ERR:
    addi $at, $at, 0x0001
    j ENDP

ENDP:
    addi $k1, $k1, 0x0001


   HIT_GOOD_TRAP		#stop temu